﻿
@using System.Web.Mvc.Html
@using Orchard.Mvc.Html
@using Coevery.Relationship.Settings
@model ReferenceFieldSettings

@{
    string disabled = string.Empty;
    if (Model.QueryId > 0) {
        disabled = "disabled='disabled'";
    }
}
<section class="control-group data-row">
    <label class="control-label" for="@Html.FieldIdFor(m => m.ContentTypeName)"> Primary Entity </label>
    <div class="controls">
        <select id="@Html.FieldIdFor(m => m.ContentTypeName)" @disabled name="@Html.FieldNameFor(m => m.ContentTypeName)" class="span12">
            @foreach (var item in Model.ContentTypeList) {
                @Html.SelectOption(item.Value, item.Selected, item.Text)
            }
        </select>
    </div>
</section>
<section class="control-group data-row">
    <label class="control-label required">
        Relation Name
    </label>
    <div class="controls errortips">
        <input type="text" class="span12" required="" name="@Html.NameFor(m=>m.RelationshipName)" value="@Model.RelationshipName" @disabled />
    </div>
</section>
<section class="control-group data-row">
    <label class="control-label">
    </label>
    <div class="controls">
        <label class="checkbox">
            @Html.CheckBoxFor(m => m.DisplayAsLink)
            Display as link
        </label>
    </div>
</section>
@if (Model.RelationshipId > 0) {
    @Html.HiddenFor(model => model.RelationshipId)
    @Html.HiddenFor(m => m.QueryId)
    @Html.HiddenFor(m => m.ContentTypeName)
    @Html.HiddenFor(model=>model.RelationshipName)
}




